package ventas.dao;

import java.sql.*;

public class Aplicacion1 {

    public static void main(String[] args) {
        try {
            Class.forName("com.mysql.jdbc.Driver");
            Connection con =
                    DriverManager.getConnection("jdbc:mysql://127.0.0.1/masters3", "root", "");
            Statement stmt = con.createStatement();
            String idUsuario = "1";
            ResultSet rs = stmt.executeQuery("select idUsuario,nombre,ruc,dni,clave,tipo from usuario where idUsuario=' " + idUsuario + " ' ");
            if (rs.next()) {
                System.out.println("Nombres: " + rs.getString("nombre"));
                System.out.println("RUC: " + rs.getString("ruc"));
                System.out.println("DNI: " + rs.getString("dni"));
                System.out.println("Clave: " + rs.getString("clave"));
                System.out.println("Tipo: " + rs.getString("tipo"));
            }
            rs.close();
            stmt.close();
            con.close();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}

